home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Message Dialogs / alert-once-message.izs < prev    next >
Text File  |  2005-09-27  |  2KB  |  116 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Alert (once) message script
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>Alert a basic message to your visitors when they visit your webpage. And to not irritate them, the script controls the frequency of this alert to only once per browser session.
  7.  
  8. <!/DESCRIPTION> 
  9.  
  10. <!CATEGORY>messages<!/CATEGORY>
  11.  
  12. <!SCRIPT>
  13. <!-- START OF SCRIPT -->
  14. <script>
  15.  
  16. //specify message to alert
  17. var alertmessage="hello world"
  18.  
  19. ///No editing required beyond here/////
  20.  
  21. //Alert only once per browser session (0=no, 1=yes)
  22. var once_per_session=1
  23.  
  24.  
  25. function get_cookie(Name) {
  26.   var search = Name + "="
  27.   var returnvalue = "";
  28.   if (document.cookie.length > 0) {
  29.     offset = document.cookie.indexOf(search)
  30.     if (offset != -1) { // if cookie exists
  31.       offset += search.length
  32.       // set index of beginning of value
  33.       end = document.cookie.indexOf(";", offset);
  34.       // set index of end of cookie value
  35.       if (end == -1)
  36.          end = document.cookie.length;
  37.       returnvalue=unescape(document.cookie.substring(offset, end))
  38.       }
  39.    }
  40.   return returnvalue;
  41. }
  42.  
  43. function alertornot(){
  44. if (get_cookie('alerted')==''){
  45. loadalert()
  46. document.cookie="alerted=yes"
  47. }
  48. }
  49.  
  50. function loadalert(){
  51. alert(alertmessage)
  52. }
  53.  
  54. if (once_per_session==0)
  55. loadalert()
  56. else
  57. alertornot()
  58.  
  59. </script>
  60. <!-- END OF SCRIPT -->
  61. <!/SCRIPT>
  62.  
  63. <!PREVIEW>
  64. <!-- START OF SCRIPT -->
  65. <script>
  66.  
  67. //specify message to alert
  68. var alertmessage="hello world"
  69.  
  70. ///No editing required beyond here/////
  71.  
  72. //Alert only once per browser session (0=no, 1=yes)
  73. var once_per_session=1
  74.  
  75.  
  76. function get_cookie(Name) {
  77.   var search = Name + "="
  78.   var returnvalue = "";
  79.   if (document.cookie.length > 0) {
  80.     offset = document.cookie.indexOf(search)
  81.     if (offset != -1) { // if cookie exists
  82.       offset += search.length
  83.       // set index of beginning of value
  84.       end = document.cookie.indexOf(";", offset);
  85.       // set index of end of cookie value
  86.       if (end == -1)
  87.          end = document.cookie.length;
  88.       returnvalue=unescape(document.cookie.substring(offset, end))
  89.       }
  90.    }
  91.   return returnvalue;
  92. }
  93.  
  94. function alertornot(){
  95. if (get_cookie('alerted')==''){
  96. loadalert()
  97. document.cookie="alerted=yes"
  98. }
  99. }
  100.  
  101. function loadalert(){
  102. alert(alertmessage)
  103. }
  104.  
  105. if (once_per_session==0)
  106. loadalert()
  107. else
  108. alertornot()
  109.  
  110. </script>
  111.  
  112. <!-- END OF SCRIPT -->
  113. <!/PREVIEW>
  114.  
  115. <!RELATED>NONE<!/RELATED>
  116.